<template>
  <div>
    <h1>兄弟2</h1>
    <input type="text" v-model="info" />
    <button @click="test">触发事件中的emit</button>
    <button @click="test1">触发侄子中的$on yangyang</button>
  </div>
</template>

<script>
export default {
  mounted() {
    console.log(this.$eventBus);
  },
  data() {
    return {
      info: "",
    };
  },
  methods: {
    test() {
      //   1.收集info
      // 2 触发emit
      // this.info
      let msg = this.info;
      this.$eventBus.$emit("fuhao", msg);
    },
    test1() {
      this.$eventBus.$emit("yangyang");
    },
  },
};
</script>

<style lang="scss" scoped>
</style>